<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    .box {
        width: 200px;
        height: 200px;
        border: 1px solid #000;
        margin: 30% auto;

    }

    .stage {
        position: relative;
        width: 200px;
        height: 200px;
        border: 1px solid #000;
        /* 透视 */
        perspective: 1000px;
        /* 过渡 */
        transition: all 1s ease;
        /* transform-style 用于设置被嵌套的子元素在父元素的3D空间中显示 子元素会保留自己的3D转换坐标轴 属性值：1.flat 所有子元素在2D平面呈现 2.preserve-3d 保留3D空间 */
        transform-style: preserve-3d;
    }

    .stage:hover {
        transform: rotateX(360deg) rotateY(360deg);
    }

    .stage div {
        position: absolute;
        top: 0;
        left: 0;
        width: 200px;
        height: 200px;
        font: bold 80px/200px "arial";
        text-align: center;
    }

    .stage div:nth-child(1) {
        background-color: rgba(255, 0, 0, 0.5);
        transform: translateZ(100px);
    }

    .stage div:nth-child(2) {
        background-color: rgba(0, 255, 0, 0.5);
        transform: rotateX(90deg) translateZ(100px);
    }

    .stage div:nth-child(3) {
        background-color: rgba(0, 0, 255, 0.5);
        transform: rotateX(90deg) translateZ(100px);
    }

    .stage div:nth-child(4) {
        background-color: rgba(255, 255, 0, 0.5);
        transform: rotateX(180deg) translateZ(100px);
    }

    .stage div:nth-child(5) {
        background-color: rgba(255, 0, 255, 0.5);
        transform: rotateY(90deg) translateZ(100px);
    }

    .stage div:nth-child(6) {
        background-color: rgba(0, 255, 255, 0.5);
        transform: rotateY(-90deg) translateZ(100px);
    }
</style>

<body>
    <div class="box">
        <div class="stage">
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <div>5</div>
            <div>6</div>
        </div>
    </div>
</body>

</html>